package config

import (
	"github.com/spf13/viper"
	"log"
)

type Config struct {
	Mysql
	Redis
}

type Mysql struct {
	Host     string
	Pose     int
	User     string
	Password string
	DB       string
}

type Redis struct {
	Addr     string
	Password string
	DB       int
}

var Conf Config

func Init() {
	viper.SetConfigFile("./config/config.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		log.Println("viper.ReadInConfig", err)
		return
	}
	err = viper.Unmarshal(&Conf)
	if err != nil {
		log.Println("viper.Unmarshal", err)
		return
	}

}
